<?php
/* @var $this ChuongtrinhController */
/* @var $model Chuongtrinh */
/* @var $form CActiveForm */
?>

<div class="wide form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'action'=>Yii::app()->createUrl($this->route),
	'method'=>'get',
)); ?>

<table class="tableSearch">
	<div class="row">
	<tr>
		<td><?php echo $form->label($model,'madonvi'); ?></td>
		<td><?php
		$connection=Yii::app()->db;   // assuming you have configured a "db" connection
		$commandDV=$connection->createCommand()
					->select('madonvi,tendonvi,thuocSGU')
					->from('donvicongtac')
					->query();
					$khoa= array();
					foreach($commandDV as $rowDV)
					{
						//array_push($ngach,$row);
						if($rowDV['thuocSGU']==1)
						{
						$khoa[$rowDV['madonvi']]=$rowDV['tendonvi'];}
					}
		
		echo $form->dropDownList($model,'madonvi',$khoa,array('empty'=>'')); ?></td>
		<td></td>
		<td><?php echo $form->label($model,'madonviday'); ?></td>
		<td><?php
		$commandDV=$connection->createCommand()
					->select('madonvi,tendonvi,laKhoa')
					->from('donvicongtac')
					->query();
		$khoa= array();
		foreach($commandDV as $rowDV)
		{
			//array_push($ngach,$row);
			if($rowDV['laKhoa']==1)
			{
			$khoa[$rowDV['madonvi']]=$rowDV['tendonvi'];}
		}
		
		echo $form->dropDownList($model,'madonviday',$khoa,array('empty'=>'')); ?></td>
	</tr>
	</div>

	<div class="row">
	<tr>
		<td><?php echo $form->label($model,'he'); ?></td>
		<td><?php echo $form->dropDownList($model,'he',array('rong'=>'','ĐH'=>'Đại học','CĐ'=>'Cao đẳng'),array('empty'=>'')); ?></td>
		<td></td>
		<td><?php echo $form->label($model,'hocki'); ?></td>
		<td><?php
			$hocki=array();
			for($i=1;$i<=8;$i++)
				$hocki[$i]=$i;
			echo $form->dropDownList($model,'hocki',$hocki,array('empty'=>'')); ?></td>
	</tr>
	</div>

	<div class="row">
	<tr>
		
	</tr>
	</div>

	<div class="row buttons">
	<tr>
		<td></td>
		<td><?php echo CHtml::submitButton('Tìm kiếm',array('id'=>'btnTim')); ?></td>
	</tr>
	</div>
	</table>

<?php $this->endWidget(); ?>

</div><!-- search-form -->